import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login')
  },
  {
    path: '/',
    name: '/',
    component: () => import('../layout'),
    redirect: '/user', // 默认 to children.name
    children: [
      {
        path: '/user',
        name: 'user',
        component: () => import('@/views/user/index.vue')
      },
      {
        path: '/job',
        name: '岗位管理',
        component: () => import('@/views/job/index.vue')
      },
      {
        path: '/perm',
        name: '权限管理',
        component: () => import('@/views/perm/index.vue')
      },
      {
        path: '/sys',
        name: '系统管理',
        component: () => import('@/views/sys/index.vue')
      },
      {
        path: '/goods',
        name: '商品管理',
        component: () => import('@/views/goods/index.vue')
      },
      {
        path: '/order',
        name: '订单管理',
        component: () => import('@/views/order/index.vue')
      },
      {
        path: '/reports',
        name: '报表管理',
        component: () => import('@/views/reports/index.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
